package com.yiqi.liebang.feature.mine.view;

import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.widget.TextView;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.framework.AM;
import com.suozhang.framework.framework.BaseActivity;
import com.yiqi.liebang.R;
import com.yiqi.liebang.framework.api.HomeApi;

import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class CouponInstructionsActivity extends BaseActivity {


    @BindView(R.id.toolbar)
    Toolbar mToolbar;
    @BindView(R.id.v_desc)
    TextView mVDesc;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_coupon_instructions;
    }

    @Override
    protected void initInjector() {

    }

    @Override
    protected void initView() {
        initToolBar(mToolbar, "优惠券说明", true, true);
    }

    @Override
    protected void initData() {
        AM.api().createApiService(HomeApi.class).getShuom()
                .compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer())
                .subscribe(new Observer<String>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                        showLoading();
                    }

                    @Override
                    public void onNext(String s) {

                        mVDesc.setText(Html.fromHtml(s));
                    }

                    @Override
                    public void onError(Throwable e) {
                        dismissLoading();
                        showErrorMsg(e.getMessage());
                    }

                    @Override
                    public void onComplete() {
                        dismissLoading();
                    }
                });

    }


}
